#pragma once
#include "TypeDefinitions.h"
#include "CPolygon.h"
#include "RandomGenerators.h"

class TriangleBuilder
{
public:

	~TriangleBuilder(void)
	{
	}

	ColorT* buildRandomColor()
	{
		ColorT* color = new ColorT[3];

		for(int i = 0; i<channelsNumber; i++)
			color[i] = random(255);

		return color;
	}


	CPolygon* buildSmallTriangle()
	{
		Verticles* verticles = new Verticles(3, 2, 1, 1, 0);
		
		int xStart = random(3, width - 3);
		int yStart = random(3, height - 3);

		for(int j=0; j<3; j++)
		{
			for(int i = 0; i<2; i++)
			{
				(*verticles)(j, 0) = std::min(std::max(xStart + random(-3, 3), 0), 198);
				(*verticles)(j, 1) = std::min(std::max(yStart + random(-3, 3), 0), 198);
			}
		} 

		/*
		int xStart = random(0, width);
		int yStart = random(0, height);


		for(int j=0; j<3; j++)
		{
			for(int i = 0; i<2; i++)
			{
				(*verticles)(j, 0) = std::min(std::max(0, xStart + random(-3, 3)), width);
				(*verticles)(j, 1) = std::min(std::max(0, yStart + random(-3, 3)), height);
			}
		}
		
		*/
		CPolygon* tr = new CPolygon(verticles, buildRandomColor(),  randomFloat(opacityMin, opacityMax));
		return tr;
	}



	void buildPoint(LocationT& x, LocationT& y)
	{
		x = random(width);
		y = random(height);
	}

private:

};

